package com.example.apple.hxbtc.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.example.apple.hxbtc.R;
import com.example.apple.hxbtc.activity.AboutActivity;
import com.example.apple.hxbtc.activity.FeedbackActivity;
import com.example.apple.hxbtc.activity.PtrrvListViewMode;
import com.example.apple.hxbtc.activity.RateActivity;
import com.example.apple.hxbtc.activity.UserLoginActivity;

/**
 * Created by hpz on 17/2/21.
 */

public class MeFragment extends Fragment implements View.OnClickListener{

    private RelativeLayout relativeLayout;
    private RelativeLayout relativeLayout_one;
    private RelativeLayout relativeLayout_two;
    private RelativeLayout relativeLayout_three;

    private FrameLayout head;

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        relativeLayout = (RelativeLayout) view.findViewById(R.id.user_aboutusss);
        relativeLayout_one = (RelativeLayout) view.findViewById(R.id.user_aboutus);
        relativeLayout_two = (RelativeLayout) view.findViewById(R.id.user_aboutuss);
        relativeLayout_three = (RelativeLayout) view.findViewById(R.id.user_setting);

        head = (FrameLayout) view.findViewById(R.id.user_head);
        relativeLayout.setOnClickListener(this);
        relativeLayout_two.setOnClickListener(this);
        relativeLayout_one.setOnClickListener(this);
        relativeLayout_three.setOnClickListener(this);
        head.setOnClickListener(this);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.fragment_me, container, false);
        return view;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.user_aboutus:
                Intent intent = new Intent();
                intent.setClass(getActivity(), PtrrvListViewMode.class);
                startActivity(intent);
                break;

            case R.id.user_aboutusss:
                Intent i = new Intent();
                i.setClass(getActivity(), AboutActivity.class);
                startActivity(i);
                break;
            case R.id.user_aboutuss:
                Intent intent1 = new Intent();
                intent1.setClass(getActivity(), FeedbackActivity.class);
                startActivity(intent1);
                break;
            case R.id.user_setting:
                Intent intent2 = new Intent();
                intent2.setClass(getActivity(), RateActivity.class);
                startActivity(intent2);
                break;
            case R.id.user_head:
                Intent intent3 = new Intent();
                intent3.setClass(getActivity(), UserLoginActivity.class);
                startActivity(intent3);
                break;

        }
    }
}
